using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Coriander.Xmpp.Xmpp.Security;

namespace Test
{
    /// <summary>
    /// 
    /// </summary>
    [TestFixture]
    public class JidTestFixture
    {
        /// <summary>
        /// 
        /// </summary>
        [Test]
        public void ParseTestWithValidValue()
        {
            String value = "ben.biddington@gmail.com/example";

            Jid jid = Jid.Parse(value);

            Console.WriteLine(
                "domain: {0}", jid.Domain
            );

            Console.WriteLine(
                "node: {0}", jid.Node
            );

            Console.WriteLine(
                "resource: {0}", jid.Resource
            );

            Console.WriteLine(
                "full value: {0}", jid.Value
            );

            Assert.AreEqual(jid.Value, value); 
        }

        /// <summary>
        /// Ensures that parsing preserves whitespace
        /// </summary>
        [Test]
        public void ParseTestPreservesWhiteSpace()
        {
            String value = "ben.biddington@gmail.com/    example with whitespace   ";

            Jid jid = Jid.Parse(value);

            Assert.AreEqual(jid.Value, value);

            String trimmedValue = jid.Value.Trim();

            Assert.AreNotEqual(jid.Value.Trim(), value); 
        }
    }
}
